package com.ln.dm1103.demo01;

/**
 * @author Ln
 * @version 终极版
 * @date 2022/11/3 15:44
 */
public class Test02 {
    public static void main(String[] args) {
        Operator operator=(arr)->{
            int sum=0;
            for (int a :arr){
                sum+=a;
            }
            return sum;
        };
        fun(operator);
    }

    public static void fun(Operator operator){
        int arr1[]={50,51,52,53};
        int sum=operator.sum(arr1);
        System.out.println("数组中元素的和:" + sum);
    }
}
interface Operator{
    //求数组中元素的和
    public int sum(int[] arr);
}
